package com.itheima.day16.task;

import java.io.*;

import java.text.SimpleDateFormat;

import java.util.Comparator;
import java.util.Date;
import java.util.TreeSet;

public class Person {
    private  String name;
    private int age;

    public  void run(){
        System.out.println("我"+name+"是一个好人");

    }
    public void show(Date date){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
        String format = sdf.format(date);
        System.out.println(format);
    }
    public  void copy(String fileName) throws IOException {
        BufferedReader  br=new BufferedReader(new InputStreamReader(new FileInputStream(fileName),"gbk"));

        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("zuoye\\b.txt"),"utf-8"));
        //可以使用ArrayList集合，利用Collections.reverse()方法进行集合反转
        TreeSet<String>   ts=new TreeSet<String>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return -1;
            }
        });
        String len;
        while ((len=br.readLine())!=null){
            ts.add(len);
        }
        for (String s : ts) {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }
        br.close();
        bw.close();
    }
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Person() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" + "name='" + name + '\'' + ", age=" + age + '}';
    }
}
